package com.sinothk.hussars.controller;


import com.sinothk.hussars.base.BaseController;
import com.sinothk.hussars.entity.UserEntity;
import com.sinothk.hussars.entity.WxUserEntity;
import com.sinothk.hussars.service.WxUserService;
import com.sinothk.server.support.annotation.callback.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 小程序用户表 前端控制器
 * </p>
 *
 * @author liangyt
 * @since 2021-01-05
 */
@Api(tags = "受检_微信小程序用户")
@RestController
@RequestMapping("/wxUser")
@ResponseResult()
public class WxUserController extends BaseController {

    private final WxUserService wxUserService;

    public WxUserController(WxUserService wxUserService) {
        this.wxUserService = wxUserService;
    }

    @ApiOperation(value = "新增微信用户")
    @PostMapping("/save")
    public WxUserEntity save(@RequestBody WxUserEntity userEntity) {
//        // 参数验证
//        if (StringUtil.isEmpty(userEntity.getIdNum())) throw new BizException("身份证不能为空");
//        // 存在验证
//        LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(UserEntity::getIdNum, userEntity.getIdNum());
//        UserEntity dbUser = wxAppService.getOne(queryWrapper);
//        if (dbUser != null) throw new BizException(ResultCode.USER_HAS_EXISTED);
//        // 保存
//        wxAppService.save(userEntity);
        return userEntity;
    }
}

